<?php defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<script language="javascript">

function submitbutton(pressbutton)
{
	var form = document.adminForm;

	if (pressbutton == 'cancel') {
		submitform( pressbutton );
		return;
	}
	// do field validation
	if (form.name.value == ""){
		alert( "<?php echo JText::_( 'Auction must have a name', true ); ?>" );
		form.name.focus();
	} else if (form.auction_date.value == 0){
		alert( "<?php echo JText::_( 'Auction must have a date', true ); ?>" );
		form.auction_date.focus();
	} else {
		submitform( pressbutton );
	}
}
</script>
<?php 
$editor = &JFactory::getEditor();
JHTML::_('behavior.calendar');
?>

<form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data" >
 <fieldset class="adminform">
  <legend><?php echo JText::_( 'Detail' ); ?></legend>
  <table width="100%" border="0" class="admintable" cellspacing="1" cellpadding="0">
    <tr>
      <td class="key"><?php echo JText::_( 'Product name' ); ?>:</td>
      <td><select name="product_id" id="product_id">
      	<?php echo $this->itemOpt;?>
      </select>
      </td>
    </tr>
    <tr>
      <td class="key">Date</td>
      <td><?php echo JHTML::_('calendar', $this->auction->auction_date, 'auction_date', 'auction_date', '%d-%m-%Y', array('class'=>'inputbox', 'size'=>'32',  'maxlength'=>'32')); ?> </td>
    </tr>
     <tr>
      <td class="key">Desired price</td>
      <td><input class="text_area" type="text" name="desiredprice" id="desiredprice" size="20" maxlength="250" value="<?php echo htmlspecialchars($this->auction->desiredprice);?>" /> DKK</td>
    </tr>
	<tr>
      <td class="key">Published</td>
      <td><input type="radio" name="published" value="1" <?php if($this->auction->published || !$this->auction->id) echo 'checked="checked"'; ?>  />
        Yes
        <input type="radio" name="published" value="0" <?php if(!$this->auction->published && $this->auction->id) echo 'checked="checked"'; ?> />
        No</td>
    </tr>
  </table>
  <input type="hidden" name="option" value="com_auction" />
  <input type="hidden" name="id" value="<?php echo $this->auction->id; ?>" />
  <input type="hidden" name="cid[]" value="<?php echo $this->auction->id; ?>" />
  <input type="hidden" name="task" value="edit" />
  <input type="hidden" name="currentprice" value="<?php if($this->auction->currentprice) echo $this->auction->currentprice; else echo '500';?>" />
  <input type="hidden" name="controller" value="default" />
  </fieldset>
</form>
